<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>类型管理</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../include/commonFile.jsp" %>
</head>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" <c:if test="${!empty subjectId}">action="${ctx}/mall/showcategory/list.do"</c:if>
                  <c:if test="${!empty templateId}">action="${ctx}/mall/showtemplatecategory/list.do"</c:if>  id="myForm" method="get">
                <input type="hidden" name="pageNo" id="pageNo"/>
                <input type="hidden" name="subjectId" id="subjectId" value="${subjectId}"/>
                <input type="hidden" name="templateId" id="templateId" value="${templateId}"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline"><label class="search-form-lable">类型名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="name" autocomplete="off" class="layui-input"
                                           value="${mallShowCategoryQuery.name}" placeholder="类型名称">
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger"
                                       href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal"
                                       href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">发布时间</label>
                                <div class="check-btn-inner" id="timeType">
                                    <a id="all" href="javascript:void(0);"
                                       onclick="setTimeType($(this),0,'#myForm')" ${empty mallShowCategoryQuery.timeType || mallShowCategoryQuery.timeType == 0 ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${mallShowCategoryQuery.timeType == 1 ? 'class="active"' : ''}>今天</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),2,'#myForm')" ${mallShowCategoryQuery.timeType == 2 ? 'class="active"' : ''}>本周内</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),3,'#myForm')" ${mallShowCategoryQuery.timeType == 3 ? 'class="active"' : ''}>本月内</a>
                                    <input type="hidden" name="timeType" value="${mallShowCategoryQuery.timeType}"/>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createStart"
                                               value="${mallShowCategoryQuery.createStart}" placeholder="开始日">
                                    </div>
                                    -
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createEnd"
                                               value="${mallShowCategoryQuery.createEnd}" placeholder="截止日">
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="c-time-list-content">
                <ul>
                    <c:if test="${page.totalCount == 0}">
                        <div class="f16 tc mt15">还没有数据，请点击右上角的“发布类型”，发布和编辑内容</div>
                    </c:if>
                    <c:forEach var="category" items="${categoryList}">
                        <li>
                            <c:if test="${!empty subjectId}">
                                <div class="detail-content">
                                    <a href="${ctx}/mall/showcategory/categoryform.do?id=${category.id}&subjectId=${subjectId}"
                                       target="_self" class="act-logo common-img"
                                    >
                                        <img src="<c:if test="${category.pic != null}">${category.pic}?imageMogr2/auto-orient/crop/200x150</c:if>" alt="" onerror="txz.errImg(this)" onload="txz.imgLoad(this)">

                                    </a>
                                    <div class="detail">
                                        <div class="act-title">
                                            <a title="${category.name}"
                                               href="${ctx}/mall/showcategory/categoryform.do?id=${category.id}&subjectId=${subjectId}"
                                               target="_self"
                                               class="title f18 ell db">${category.name}</a>
                                        </div>
                                        <div>
                                            <p class="act-price">
                                                发布时间：
                                                <fmt:formatDate value="${category.createDate}" pattern="yyyy-MM-dd HH:mm"/>
                                            </p>
                                        </div>
                                        <div class="opts-btns tb-opts" style="width:475px;">
                                            <div class="comm-opts">
                                                <!-- <a class="qr-btn" href="javascript:void(0);"><i class="iconfont icon-qrcode btn-icon"></i> 二维码</a> -->
                                                <a href="${ctx}/mall/showcategory/categoryform.do?id=${category.id}&subjectId=${subjectId}">
                                                    <i class="iconfont icon-edit btn-icon"></i>
                                                    编辑
                                                </a>
                                                <a href="${ctx}/mall/showgoods/list.do?subjectId=${subjectId}&categoryId=${category.id}">
                                                    <i class="iconfont icon-group btn-icon"></i>
                                                    导购商品管理
                                                </a>
                                                <a href="javascript:txz.deleteObject('确定删除项目？', '${ctx}/mall/showcategory/delete.do?id=${category.id}')">
                                                    <i class="iconfont icon-delete btn-icon"></i> 删除
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </c:if>
                            <c:if test="${!empty templateId}">
                                <div class="detail-content">
                                    <a href="${ctx}/mall/showtemplatecategory/categoryform.do?id=${category.id}&templateId=${templateId}"
                                       target="_self" class="act-logo common-img"
                                    >
                                        <img src="<c:if test="${category.pic != null}">${category.pic}?imageMogr2/auto-orient/crop/200x150</c:if>" alt="" onerror="txz.errImg(this)" onload="txz.imgLoad(this)">

                                    </a>
                                    <div class="detail">
                                        <div class="act-title">
                                            <a title="${category.name}"
                                               href="${ctx}/mall/showtemplatecategory/categoryform.do?id=${category.id}&templateId=${templateId}"
                                               target="_self"
                                               class="title f18 ell db">${category.name}</a>
                                        </div>
                                        <div>
                                            <p class="act-price">
                                                发布时间：
                                                <fmt:formatDate value="${category.createDate}" pattern="yyyy-MM-dd HH:mm"/>
                                            </p>
                                        </div>
                                        <div class="opts-btns tb-opts" style="width:475px;">
                                            <div class="comm-opts">
                                                <!-- <a class="qr-btn" href="javascript:void(0);"><i class="iconfont icon-qrcode btn-icon"></i> 二维码</a> -->
                                                <a href="${ctx}/mall/showtemplatecategory/categoryform.do?id=${category.id}&templateId=${templateId}">
                                                    <i class="iconfont icon-edit btn-icon"></i>
                                                    编辑
                                                </a>
                                                <a href="${ctx}/mall/showtemplategoods/list.do?templateId=${templateId}&categoryId=${category.id}">
                                                    <i class="iconfont icon-group btn-icon"></i>
                                                    导购商品管理
                                                </a>
                                                <a href="javascript:txz.deleteObject('确定删除项目？', '${ctx}/mall/showcategory/delete.do?id=${category.id}')">
                                                    <i class="iconfont icon-delete btn-icon"></i> 删除
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </c:if>
                        </li>
                    </c:forEach>
                </ul>
            </div>
            <div class="page-content">
                <div id="page_content" class="page-container"></div>
            </div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>

<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript">

    $(function () {
        // 二维码弹窗显示/隐藏
        qrCodeDialog('.c-time-list-content', 'qr-btn', '.detail-content', '.bmDialog');
        //加载分页
        loadPageNew({elem: 'page_content', totalCount: '${page.totalCount}', limit: '${page.limit}', page: '${page.page}'});
        layui.use(['laydate'], function () {
            var laydate = layui.laydate;
            // 查询发布日期
            var start = {
                elem: 'input[name=createStart]'
            };

            var end = {
                elem: 'input[name=createEnd]'
            };
            laydate.render(start);
            laydate.render(end);
        });
        layui.use(['laytpl', 'laypage', 'element'], function () {
            laytpl = layui.laytpl;
            laypage = layui.laypage;
            element = layui.element;

        });
    })
</script>
<script type="text/javascript">
    txz.initHeader({
        <c:if test="${!empty subjectId}">
        nav:[{
            name: '导购主题',
            href:'${ctx}/mall/showsubject/list.do'
        },{
            name: '类型管理',
            curr: true
        }],
        info:'<span class="f12">共<b id="totalCount">${page.totalCount}</b>条记录</span>',
        btns:[{
            name: '发布类型',
            icon: 'add',
            href: '${ctx}/mall/showcategory/categoryform.do?subjectId=${subjectId}'
        },{
            name: '返回',
            icon: 'back',
            href: '${ctx}/mall/showsubject/list.do'
        }]
        </c:if>

        <c:if test="${!empty templateId}">
        nav:[{
            name: '主题分类',
            href:'${ctx}/mall/showtemplate/list.do'
        },{
            name: '类型管理',
            curr: true
        }],
        info:'<span class="f12">共<b id="totalCount">${page.totalCount}</b>条记录</span>',
        btns:[{
            name: '发布类型',
            icon: 'add',
            href: '${ctx}/mall/showtemplatecategory/categoryform.do?templateId=${templateId}'
        },{
            name: '返回',
            icon: 'back',
            href: '${ctx}/mall/showtemplate/list.do'
        }]
        </c:if>
    });
</script>
</body>
</html>